package com.taxshare.seller.controller;

import com.taxshare.response.beans.Response;
import com.taxshare.seller.entity.SellerPrintConfigEntity;
import com.taxshare.seller.service.PrinterService;
import com.taxshare.seller.view.dto.SynchronizeInvoiceDTO;
import com.taxshare.seller.view.vo.printer.PrintReqVO;
import com.taxshare.seller.view.vo.printer.PrinterConfigVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/printer")
@Api(tags="税神通打印服务")
public class PrinterControer {

    @Autowired
    public PrinterService printerService;

    @GetMapping("/checkPrinter")
    @ApiOperation(value = "检测是否安装或打开税神通服务", notes = "税神通打印服务")
    public Response checkPrinter(){
        return printerService.checkPrinter();
    }

    @GetMapping("/printGetPrintList")
    @ApiOperation(value = "获取当前连接的打印机信息", notes = "税神通打印服务")
    public Response printGetPrintList(){
        return printerService.printGetPrintList();
    }

    @PostMapping("/printZdyQdfp")
    @ApiOperation(value = "自定义打印清单", notes = "税神通打印服务")
    public Response printZdyQdfp(@RequestBody PrintReqVO vo){
        return printerService.printZdyQdfp(vo);
    }

    @PostMapping("/getSellerPrintConfig")
    @ApiOperation(value = "根据税号和发票类型获取打印机信息", notes = "税神通打印服务")
    public Response<SellerPrintConfigEntity> getSellerPrintConfig(@RequestBody PrinterConfigVO vo){
        return printerService.getSellerPrintConfig(vo);
    }

    @PostMapping("/getInvoiceService")
    @ApiOperation(value = "获取发票信息【地产专用】", notes = "税神通打印服务")
    public Response getInvoiceService(@RequestBody PrintReqVO vo){
        return printerService.getInvoiceService(vo);
    }

    @PostMapping("/getInvoiceListService")
    @ApiOperation(value = "获取发票信息List", notes = "税神通打印服务")
    public Response getInvoiceListService(@RequestBody PrintReqVO vo){
        return printerService.getInvoiceListService(vo);
    }

    @PostMapping("/getLocalYdy")
    @ApiOperation(value = "发票预打印", notes = "税神通打印服务")
    public Response getLocalYdy(@RequestBody SynchronizeInvoiceDTO synchronizeInvoiceDTO){
        return printerService.getLocalYdy(synchronizeInvoiceDTO);
    }

}
